﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using University.Workshop.Model;
using System.Collections.ObjectModel;
using University.Workshop.DataAccess;

namespace University.Workshop.Business
{
    public class TransactionConsultManager:IDisposable
    {
        private Client ClientTransaction;
        private Collection<DataAccess.Transaction> ListTransaction;

        public void TransactionSendManagerConnectClient()
        {            
            //Client connection
            try
            {
                ClientTransaction = new Client();
            }
            catch (System.ArgumentNullException)
            {
            }
        }
        //correccion de warning
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // dispose managed resources
                ClientTransaction.Dispose();
            }
            // free native resources
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        //
        public Collection<Transaction> BothTransaction(string userName)
        {
            //TODO   
            this.ListTransaction = ClientTransaction.GetConsultTransactionBoth(userName);          
            return (this.ListTransaction);
        }

        public Collection<Transaction> SendTransaction(string userName)
        {
            //TODO
            this.ListTransaction = ClientTransaction.GetConsultTransactionSend(userName);            
            return (this.ListTransaction);
        }

        public Collection<Transaction> ReceiveTransaction(string userName)
        {
            //TODO
            this.ListTransaction = ClientTransaction.GetConsultTransactionReceived(userName);            
            return (this.ListTransaction);
        }
    }
}
